<template>
  <div class="shezhi">
    <div class="qiehuan">
      <div @click="changeThem">是否开启深色模式</div>
      <div :class="isShow == 'off' ? 'active' : ''" @click="changetitle">
        <div>{{ isShow }}</div>
        <div></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isTitkle: "当前浅色模式",
      isShow: "no",
    };
  },
  methods: {
    changeThem() {
      if (this.isTitkle == "当前浅色模式") {
        this.$emit("change-theme", "dark");
        this.isTitkle = "当前深色模式";
      } else {
        this.$emit("change-theme", "default");
        this.isTitkle = "当前浅色模式";
      }
    },
    changetitle() {
      console.log(this.isShow);
      if (this.isShow == "off") {
        this.isShow = "NO";
        this.$emit("change-theme", "dark");
      } else {
        this.$emit("change-theme", "default");
        this.isShow = "off";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.shezhi {
  min-height: 100vh;

  .qiehuan {
    font-size: 16rem;
    text-align: left;
    margin-top: 0;
    padding-top: 50rem;
    color: @color4;
    display: flex;
    align-items: center;
    justify-content: space-around;

    > div:nth-child(2) {
      width: 100rem;
      height: 40rem;
      display: flex;
      align-items: center;
      border-radius: 20rem;
      background-color: @color4;
      color: @color2;
      text-align: center;
      transition: background 0.5s;
      transition: color 0.5s;
      
    }
    > div:nth-child(2) {
      display: flex;
      align-items: center;
      justify-content: space-around;

      > div:nth-child(2) {
        width: 35rem;
        height: 35rem;
        border-radius: 50%;
        background-color: @color1;
        z-index: 9999;
      }
    }
  }
}
.active {
  background-color: rgb(104, 202, 104) !important;
  > div:nth-child(1) {
    position: relative;
    left: 60rem;
  }
  > div:nth-child(2) {
    position: relative;
    left: -45rem;
  }
}
</style>